var range = 0;
var heightScroll = 0;

function preLoad()
{
	var viewportwidth;
	var viewportheight;
 
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
	if (typeof window.innerWidth != 'undefined')
	{
		viewportwidth = window.innerWidth;
		viewportheight = window.innerHeight;
	}
 
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

	else if (typeof document.documentElement != 'undefined'
		&& typeof document.documentElement.clientWidth !=
		'undefined' && document.documentElement.clientWidth != 0)
	{
		viewportwidth = document.documentElement.clientWidth;
		viewportheight = document.documentElement.clientHeight;
	}
 
	// older versions of IE
 
	else
	{
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
		viewportheight = document.getElementsByTagName('body')[0].clientHeight;
	}
	//alert('Your viewport width is '+viewportwidth+'x'+viewportheight);
	var wrapperTop = (viewportheight - $("#wrapper-home").height())/2;
	var wrapperLeft = (viewportwidth - $("#wrapper-home").width())/2;
	//alert('Your viewport width is '+wrapperTop+'x'+wrapperLeft);
	$("#wrapper-home").css("top",wrapperTop + "px");
	$("#wrapper-home").css("left",wrapperLeft + "px");
	
	if (document.getElementById){
		$("#pre-loader img").hide();
		$("#pre-loader").fadeOut(500);
	} 
	else {
		if (document.layers){ //NS4
			document.preloader.visibility = 'hidden';
		} else { //IE4
			document.all.preloader.style.visibility = 'hidden';
		}
	}
}

function setPosition()
{
	var viewportwidth;
	var viewportheight;
 
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
	if (typeof window.innerWidth != 'undefined')
	{
		viewportwidth = window.innerWidth;
		viewportheight = window.innerHeight;
	}
 
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

	else if (typeof document.documentElement != 'undefined'
		&& typeof document.documentElement.clientWidth !=
		'undefined' && document.documentElement.clientWidth != 0)
	{
		viewportwidth = document.documentElement.clientWidth;
		viewportheight = document.documentElement.clientHeight;
	}
 
	// older versions of IE
 
	else
	{
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
		viewportheight = document.getElementsByTagName('body')[0].clientHeight;
	}
	//alert('Your viewport width is '+viewportwidth+'x'+viewportheight);
	var wrapperTop = (viewportheight - $("#wrapper-home").height())/2;
	var wrapperLeft = (viewportwidth - $("#wrapper-home").width())/2;
	$("#wrapper-home").css("top",wrapperTop + "px");
	$("#wrapper-home").css("left",wrapperLeft + "px");
}

window.onresize = setPosition;

function initialize() {
    var latlng = new google.maps.LatLng(21.018568, 105.85472);
    var myOptions = {
      zoom: 19,
      center: latlng,
	  disableDefaultUI: true,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
		
	var image = 'images/mark.png';
	var shadow = 'images/logo_shadow.png';
	var myLatLng = new google.maps.LatLng(21.018558, 105.85472);
	var beachMarker = new google.maps.Marker({
      position: myLatLng,
	  map: map,
      icon: image,
	  shadow: shadow,	  
	});
	
	preLoad();
}

function redirectToSpecialties() {
    window.location = "Specialties.aspx";
    return false;
}

function redirectToMenu() {
    window.location = "Menu.aspx";
    return false;
}